#pragma once
#ifndef myMacro_h__
#define myMacro_h__


#define  myAlloc(size)	malloc(size)
#define  myFree(p)
#define  myNEW(obj)	new obj
#define  myNEW_ARRAY(obj,size) new obj[size]
#define  myDELETE(p)	if(p){delete p;p = vNull;}
#define  myDELETE_ARRAY(p) if(p){delete[] p;p = vNull;}
#define  myMemCopy(dst,src,size)
#define  myMemZero(dst,size)
#define  myStringLen(str)	xStrLen(str)
#define  myHighWord(n)  ((TUint16)(n>>16))
#define  myLowWord(n)   ((TUint16)(n))
#define  myDWORD(high,low) (((high)<<16) | ((low) & 0xFFFF))

#define  vSuccess 0
//#define  vHandled 1
//#define  vUnHandled 2

//#define  vFail -1
//#define  vTrue 1
//#define  vFalse 0

#ifndef ARRAY_SIZE
#define  ARRAY_SIZE(a)	(sizeof(a)/sizeof(a[0]))
#endif

#ifndef ARRAY_LAST_INDEX
#define ARRAY_LAST_INDEX(a) (sizeof(a)/sizeof(a[0])-1)
#endif

#ifndef SAFE_DELETE
#define  SAFE_DELETE(p) {if(p){myDELETE(p);p=vNull;};}
#endif

#ifndef SAFE_RELEASE
#define  SAFE_RELEASE(p) {if(p){p->Release();p=vNull;};}
#endif

#ifndef SAFE_DELETE_ARRAY
#define  SAFE_DELETE_ARRAY(p) {if(p){delete[] p;p=vNull;};}
#endif
#define  HIGH_WORD(i)	(((i)>>16)&0x0000ffff)
#define  LOW_WORD(i)	((i)&0x0000ffff)
//

#define xTypeId1(s)				(s[0])
#define xTypeId2(s)				(((xTypeId1(s)>>13) |(xTypeId1(s)<<19))+s[1])
#define xTypeId3(s)				(((xTypeId2(s)>>13) |(xTypeId2(s)<<19))+s[2])
#define xTypeId4(s)				(((xTypeId3(s)>>13) |(xTypeId3(s)<<19))+s[3])
#define xTypeId5(s)				(((xTypeId4(s)>>13) |(xTypeId4(s)<<19))+s[4])
#define xTypeId6(s)				(((xTypeId5(s)>>13) |(xTypeId5(s)<<19))+s[5])
#define xTypeId7(s)				(((xTypeId6(s)>>13) |(xTypeId6(s)<<19))+s[6])
#define xTypeId8(s)				(((xTypeId7(s)>>13) |(xTypeId7(s)<<19))+s[7])
#define xTypeId9(s)				(((xTypeId8(s)>>13) |(xTypeId8(s)<<19))+s[8])
#define xTypeId10(s)			(((xTypeId9(s)>>13) |(xTypeId9(s)<<19))+s[9])
#define xTypeId11(s)			(((xTypeId10(s)>>13) |(xTypeId10(s)<<19))+s[10])
#define xTypeId12(s)			(((xTypeId11(s)>>13) |(xTypeId11(s)<<19))+s[11])
#define xTypeId13(s)			(((xTypeId12(s)>>13) |(xTypeId12(s)<<19))+s[12])
#define xTypeId14(s)			(((xTypeId13(s)>>13) |(xTypeId13(s)<<19))+s[13])
#define xTypeId15(s)			(((xTypeId14(s)>>13) |(xTypeId14(s)<<19))+s[14])



#endif // myMacro_h__
